#include "thread.hpp"
#include "lockguard.hpp"
#include "task.hpp"
#include "threadpool.hpp"
#include "logmessage.hpp"
#include <thread>
#include <unistd.h>
#include <ctime>
#include <cstdlib>
using namespace std;

int main()
{
    srand((unsigned int)time(nullptr));
    // zty::thread_pool<zty::Task> tp(5);
    zty::thread_pool<zty::Task> &tp = zty::thread_pool<zty::Task>::GetInstance();
    tp.run();
    char ops[] = {'+', '-', '*', '/' ,'%'};
    int cnt = 5;
    while(cnt--)
    {
        int l = rand()%100;
        int r = rand()%100;
        char op = ops[rand()%5];
        zty::Task task(l, r, op);
        // printf("main_thread: %d%c%d=?\n", task._l, task._op, task._r);
        LogMessage(NORMAL, "main_thread: %d%c%d=?", task._l, task._op, task._r);
        tp.push(task);
        sleep(1);
    }
    return 0;
}
